package com.xxrl.shop.domain;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.data.mongodb.core.mapping.MongoId;

import javax.persistence.EntityListeners;
import java.io.Serializable;

/**
 * @author mis
 */

@Data
@NoArgsConstructor
@Document(collection = "product_type")
@EntityListeners(AuditingEntityListener.class)
public class ProductType implements Serializable {

    @MongoId
    private String id;

    @Field
    private String name;

    @CreatedDate
    @Field
    private Long createTime;

    @LastModifiedDate
    @Field
    private Long lastModifiedTime;

    public ProductType(String name) {
        this.name = name;
    }
}
